import { reqGetHomeList } from '@/api/home'

const state = {
  homeList: []
}
const actions = {
  async getHomeList({ commit }) {
    const res = await reqGetHomeList()
    if (res.code === 20000) {
      commit('SAVE_HOME_LIST', res.data)
    }
  }
}

const mutations = {
  SAVE_HOME_LIST(state, payload) {
    state.homeList = payload
  }
}

export default {
  namespaced: true,
  state,
  actions,
  mutations
}
